import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AuthModule } from './auth/auth.module';
import { UsersModule } from './users/users.module';
import {TypeOrmModule} from '@nestjs/typeorm'
import { DataSource } from 'typeorm'
import { User } from './users/user.entity';
import { Book } from './book/entities/book.entity';
import { Chat } from './chat/entities/chat.entity';
import { BookModule } from './book/book.module';
import { OssModule } from './oss/oss.module';
// import {} from '@nestjs/serve'
import { ChatModule } from './chat/chat.module';

@Module({
  imports: [AuthModule, UsersModule,
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: '47.93.102.179',
      port: 3306,
      username: 'lin',
      password: 'lin2024.123456',
      database: 'test',
      entities: [User,Book,Chat],
      synchronize: true,
    }),
    BookModule,
    OssModule,
    ChatModule
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {
  constructor(private dataSource:DataSource){}
}
